﻿using System;
using System.Collections.Generic;
using System.Text;
using NIIT.SaoBacDau.Aupi.HospitalManagement.Entities;
using System.Data.SqlClient;
using System.Data;

namespace NIIT.SaoBacDau.Aupi.HospitalManagement.DataAccess
{
    public class DAO_D_Positions
    {
        public static D_Positions dPosition(D_Positions dPos)
        {
            SqlDataAdapter sqlda = new SqlDataAdapter("Department.dPosition", DAO_ConnectDatabase.Connect());
            sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sqlda.SelectCommand.Parameters.Add("@PositionsID", SqlDbType.Int).Value = dPos.PositionsID;
            DataTable dtable = new DataTable();
            sqlda.Fill(dtable);
            D_Positions dPosition = new D_Positions();
            dPosition.PositionsID = dPos.PositionsID;
            dPosition.NamePositions = dtable.Rows[0]["NamePositions"].ToString();
            return dPosition;
        }
    }
}
